<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'http://www.baidu.com/'); 
        curl_exec($ch); 
        curl_close($ch);
        die;
        $this->display();
    }
    
    public function test(){
        if($_POST['state_end']==1 && $_POST['state_start']==1){
            $id = $_POST['id'];
             $this->jsonReturn("你提交的id是".$id);
        } 
    }
    public function jsonReturn ($str) {
        header('Content-type: application/json;charset=utf-8');
        $arr = array('state_start'=>1,'state_end'=>1,'text'=>$str);
        echo json_encode($arr);
        exit;
    }
}